#include <stdio.h>
#include <string.h>

int
simple_strcmp (const char *s1, const char *s2)
{
	int ret;
	
	while ( (ret = *(unsigned char *) s1 - *(unsigned char *) s2++) == 0
		&& *s1++);
	return ret;
}

int strcmp(const char *s1, const char *s2)
{
	int ret;

	while ( (ret = *(unsigned char *)s1 - *(unsigned char *)s2++) == 0 && *s1++);
	return ret;
}

int strcmp(const char *s1, const char *s2)
{
	int ret;

	while( (ret = *(unsigned char*)s1 - *(unsigned char *)s2++) == 0 && *s1++);

	return ret;
}

static char string1[] = "The quick brown dog jumps over the lazy fox";
static char string2[] = "The QUICK brown dog jumps over the lazy fox";

static void _main( void )
{
	char tmp[20];
	int result;
	/* Case sensitive */
	printf( "Compare strings:\n\t%s\n\t%s\n\n", string1, string2 );
	result = simple_strcmp( string1, string2 );

	if( result > 0 )
		strcpy( tmp, "greater than" );
	else if( result < 0 )
		strcpy( tmp, "less than" );
	else
		strcpy( tmp, "equal to" );

	printf( "\tstrcmp:   String 1 is %s string 2\n", tmp );
	/* Case insensitive */
	result = _stricmp( string1, string2 );

	if( result > 0 )
		strcpy( tmp, "greater than" );
	else if( result < 0 )
		strcpy( tmp, "less than" );
	else
		strcpy( tmp, "equal to" );

	printf( "\t_stricmp:  String 1 is %s string 2\n", tmp );
}